package cn.doitedu.test;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RegexDemo2 {


    public static void main(String[] args) {

        String events = "ACBDFABCB";



        String regex = "(B)";

        Pattern pattern = Pattern.compile(regex);

        Matcher matcher = pattern.matcher(events);

        int count = 0;
        while (matcher.find()) {
            count++;
        }

        System.out.println(count);

    }
}
